package com.xuecheng.order.controller;

import com.xuecheng.commons.model.vo.ResponseResult;
import org.springframework.web.bind.annotation.*;
import com.xuecheng.order.service.OrdersService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * <p>
 * 订单前端控制器
 * </p>
 *
 * @author HuangYuwu
 */
@Slf4j
@RestController
public class OrdersController {

    @Autowired
    private OrdersService  ordersService;

    /**
     * 创建订单
     * @param coursePubId
     * @return
     */
    @PostMapping("/orders/create/{coursePubId}")
    public ResponseResult createOrders(@PathVariable("coursePubId")Long coursePubId){
        return ordersService.createOrders(coursePubId);
    }

    /**
     * 查询是否支付成功
     * @param orderNo
     * @return
     */
    @GetMapping("/orders/{orderNo}")
    public ResponseResult findPayResult(@PathVariable("orderNo") String orderNo){
        return ordersService.findPayResult(orderNo);
    }
}
